<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>栏目管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			
		});
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/shop/cate/">栏目列表</a></li>
		<c:if test="${fns:getUser().roleIdList.contains('1')}">
		<shiro:hasPermission name="shop:cate:edit"><li><a href="${ctx}/shop/cate/form">栏目添加</a></li></shiro:hasPermission>
		</c:if>
	</ul>
	<form:form id="searchForm" modelAttribute="cate" action="${ctx}/shop/cate/" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<ul class="ul-form">
			<li><label>栏目名称：</label>
				<form:input path="name" htmlEscape="false" maxlength="255" class="input-medium"/>
			</li>
			<%--<li><label>图标：</label>
				<form:input path="icon" htmlEscape="false" maxlength="255" class="input-medium"/>
			</li>--%>
			<%--<li><label>跳转地址：</label>
				<form:input path="url" htmlEscape="false" maxlength="255" class="input-medium"/>
			</li>--%>
			<li><label>栏目类型：</label>
				<%--<form:input path="type" htmlEscape="false" maxlength="255" class="input-medium"/>--%>
				<form:select path="type" class="input-xlarge">
					<form:option value="" label="请选择"/>
					<form:options items="${fns:getDictList('categorytype')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
				</form:select>
			</li>
			<li><label>父类ID：</label>
				<form:input path="parentid" htmlEscape="false" maxlength="255" class="input-medium"/>
			</li>
			<li><label>祖类ID：</label>
				<form:input path="parentids" htmlEscape="false" maxlength="255" class="input-medium"/>
			</li>
			<li class="btns"><input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/></li>
			<li class="clearfix"></li>
		</ul>
	</form:form>
	<sys:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th>栏目名称</th>
				<th>图标</th>
				<th>跳转地址</th>
				<th>栏目类型</th>
				<th>父类ID</th>
				<th>祖类ID</th>
				<th>更新时间</th>
				<th>备注</th>
				<shiro:hasPermission name="shop:cate:edit"><th>操作</th></shiro:hasPermission>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="cate">
			<tr>
				<td><a href="${ctx}/shop/cate/form?id=${cate.id}">
					${cate.name}
				</a></td>
				<td>
						<img src="${cate.icon}" style="width: 100px;height: 50px">
				</td>
				<td title="${cate.url}">
					${fns:abbr(cate.url,30)}
				</td>
				<td>
					${fns:getDictLabel(cate.type,"categorytype",null)}
				</td>
				<td>
					${cate.parentid}
				</td>
				<td>
					${cate.parentids}
				</td>
				<td>
					<fmt:formatDate value="${cate.updateDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
				</td>
				<td>
					${cate.remarks}
				</td>
				<c:if test="${fns:getUser().roleIdList.contains('1')}">
				<shiro:hasPermission name="shop:cate:edit"><td>
    				<a href="${ctx}/shop/cate/form?id=${cate.id}">修改</a>
					<a href="${ctx}/shop/cate/delete?id=${cate.id}" onclick="return confirmx('确认要删除该栏目吗？', this.href)">删除</a>
				</td></shiro:hasPermission>
				</c:if>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>